package com.dctp.common.vo;

/**
 * 资金变动类型枚举，对应dctp_fund_flow.change_type字段
 */
public enum OrderDealType {

    LAST_PRICE_DEAL(1, "市价成交"),
    HAND_UP_PRICE_DEAL(2, "委托成交"),
    FOCUS_DEAL(3, "触发平仓"),
    PROFIT_LOSS_DEAL(4, "止盈止损"),
    EMS_DEAL(5, "后台平仓");

    private final int code;
    private final String desc;

    OrderDealType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static OrderDealType fromCode(int code) {
        for (OrderDealType t : values()) {
            if (t.code == code) return t;
        }
        return null;
    }
}
